package com.anolesoft.yr.mbus.prod.pack.sql;

public class ProdPackageServiceSQL {

    //新增产品套餐服务项信息表
    public static final String SAVE_PROD_PACKAGE_SERVICE = "insert into prod_package_service(objuid,fac_code,prod_package_uid,prod_service_uid,service_option_code,service_option_name,import_type) values(#{objuid},#{facCode},#{prodPackageUid},#{prodServiceUid},#{serviceOptionCode},#{serviceOptionName},#{importType})";

    //根据主键查询产品套餐服务项唯一数据
    public static final String QUERY_PROD_PACKAGE_SERVICE_BY_UID = "select c.service_option_code,c.service_option_name,d.value,d.is_default,d.is_holiday,d.accept_time,d.reply_time,d.delivery_time,d.arrival_time,e.objuid as update_service_objuid,f.objuid as update_service_value_objuid,c.objuid as prod_package_service_objuid,d.objuid as prod_package_service_value_objuid from prod_package a left join prod_package_rel b on b.prod_package_uid=a.objuid left join prod_package_service c on c.objuid=b.prod_package_service_uid left join prod_package_service_value d on d.prod_package_service_uid=c.objuid left join prod_service e on e.objuid=c.prod_service_uid left join prod_service_value f on f.objuid=d.prod_service_value_uid where a.del_flag=0 and a.objuid=#{objuid} order by c.service_option_name asc, d.value asc";

    //修改产品套餐服务项信息表
    public static final String UPDATE_PROD_PACKAGE_SERVICE = "update prod_package_service a set a.prod_service_uid=#{prodServiceUid},a.service_option_code=#{serviceOptionCode},a.service_option_name=#{serviceOptionName},a.import_type=#{importType} where a.objuid=#{objuid}";

    //删除产品套餐服务项信息表
    public static final String DELETE_PROD_PACKAGE_SERVICE = "<script> delete from prod_package_service where prod_package_uid=#{prodPackageUid} and objuid not in <foreach collection='prodPackageServiceDeleteDTOList' open='(' item='prodPackageService' separator=',' close=')'> #{prodPackageService.objuid}</foreach> </script>";

    //根据主键查询产品套餐服务项唯一数据
    public static final String QUERY_PROD_PACKAGE_SERVICE_BY_UID2 = "select a.* from prod_package_service a where a.prod_package_uid=#{objuid}";

}
